<?php
class DB
{
    private static $instance = NULL;

    public static function getInstance() {

        if (!self::$instance) {
            self::$instance = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME, // Data Source Name
                    					DB_USER,                                 // Username
                    					DB_PASS);                                // Password
            self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        }
        return self::$instance;
    }

    private function __clone() {
        /* interdiction de cloner l'instance */
    }

}
?>